// SelectBackgroundImageDialog.cpp : implementation file
//

#include "stdafx.h"
#include "CGWork.h"
#include "SelectBackgroundImageDialog.h"
#include "afxdialogex.h"


// SelectBackgroundImageDialog dialog

IMPLEMENT_DYNAMIC(SelectBackgroundImageDialog, CDialogEx)

SelectBackgroundImageDialog::SelectBackgroundImageDialog(CWnd* pParent /*=NULL*/)
	: CDialogEx(SelectBackgroundImageDialog::IDD, pParent)
	, filename(_T(""))
	, repeat(true)
{

}

SelectBackgroundImageDialog::~SelectBackgroundImageDialog()
{
}

void SelectBackgroundImageDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT2, filename);
	DDX_Control(pDX, IDC_EDIT2, filename_editBox);
	DDX_Radio(pDX, IDC_RADIO2, repeat);
}


BEGIN_MESSAGE_MAP(SelectBackgroundImageDialog, CDialogEx)
	ON_BN_CLICKED(IDC_BUTTON1, &SelectBackgroundImageDialog::OnBrowseClickedButton)
END_MESSAGE_MAP()


// SelectBackgroundImageDialog message handlers


void SelectBackgroundImageDialog::OnBrowseClickedButton()
{
	TCHAR szFilters[] = _T ("PNG Data Files (*.png)|*.png|All Files (*.*)|*.*||");
	CFileDialog dlg(TRUE, "png", "*.png", OFN_FILEMUSTEXIST | OFN_HIDEREADONLY ,szFilters);

	if(dlg.DoModal() != IDOK)
		return;
	filename = dlg.GetPathName();
	filename_editBox.SetWindowTextA(filename);
}
